package com.vancouver.knows.ui.activity.userpost;

import android.content.Context;
import android.view.View;

import com.pangu.ui.refresh.ARefreshViewController;
import com.pangu.ui.refresh.RefreshControllerView;
import com.vancouver.knows.MainApplication;
import com.vancouver.knows.business.BusinessModule;
import com.vancouver.knows.business.task.mark.GetUserPostsTaskMark;

/**
 * Created by Chris Li on 2016-07-28.
 */
public class FollowUserPostsPullRefreshView extends RefreshControllerView {

    public FollowUserPostsPullRefreshView(Context context) {
        super(context);
    }

    @Override
    protected View createContentView() {
        return new FollowUserPostListsView(getContext(), this);
    }

    @Override
    public void onRefresh(ARefreshViewController controller) {
        ((FollowUserPostListsView) content).handleRefreshLoadItem();
    }

    public void loadData(String page, String userId, String status) {
        BusinessModule module = ((MainApplication) imContext).getBusinessModule();
        GetUserPostsTaskMark getUserPostsTaskMark = module.getTaskMarkPool().getUserPostsTaskMark(page, userId, status);
        ((FollowUserPostListsView) content).initLoadableView(getUserPostsTaskMark);
    }
}
